package com.glsc.ngateway.platform.domain.costallocation;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author guoj
 * @description: 数据分摊任务
 * @date 2024/10/17 9:31
 */
@Data
@Entity
@Table(name = "t_costallocation_task")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class CostAllocationTask {

    @ApiModelProperty(value = "ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "l_id", columnDefinition = "int(11) comment '系统ID'")
    private Long id;

    @ApiModelProperty(value = "开始日期")
    @Column(name = "vc_start_date", columnDefinition = "varchar(10) comment '任务开始日期'")
    protected String startDate;


    @ApiModelProperty(value = "终止日期")
    @Column(name = "vc_end_date", columnDefinition = "varchar(10) comment '任务终止日期'")
    protected String endDate;

    @ApiModelProperty(value = "任务名称")
    @Column(name = "vc_task_name", columnDefinition = "varchar(200) comment '任务名称'")
    protected String taskName;

    @ApiModelProperty(value = "资产唯一标识")
    @Column(name = "vc_it_uniquekey", columnDefinition = "varchar(20) comment '资产唯一标识'")
    private String itUniqueKey;
    @ApiModelProperty(value = "ip")
    @Column(name = "vc_ip", columnDefinition = "varchar(50) comment 'ip'")
    private String vcIp;

    @ApiModelProperty(value = "分段起始日期")
    @Column(name = "vc_section_start_date", columnDefinition = "varchar(10) comment '分段起始日期'")
    private String sectionStartDate;
    @ApiModelProperty(value = "分段结束日期")
    @Column(name = "vc_section_end_date", columnDefinition = "varchar(10) comment '分段结束日期'")
    private String sectionEndDate;

    @ApiModelProperty(value = "服务器金额")
    @Column(name = "en_server_amount", columnDefinition = "decimal(20,4) comment '服务器金额'")
    private BigDecimal serverAmount;
    @ApiModelProperty(value = "数据来源")
    @Column(name = "vc_data_source", columnDefinition = "varchar(20) comment '数据来源'")
    private String dataSource;

    @ApiModelProperty(value = "系统名称")
    @Column(name = "vc_system_name", columnDefinition = "varchar(100) comment '系统名称'")
    private String systemName;

    @ApiModelProperty(value = "系统编号")
    @Column(name = "vc_system_classno", columnDefinition = "varchar(50) comment '系统编号'")
    private String systemClassNo;

    @ApiModelProperty(value = "业务对口部门一级名称")
    @Column(name = "vc_depgradeone_name", columnDefinition = "varchar(100) comment '业务对口部门一级名称'")
    private String depGradeOneName;
    @ApiModelProperty(value = "业务对口部门一级id")
    @Column(name = "vc_depgradeone_id", columnDefinition = "varchar(11) comment '业务对口部门一级id'")
    private String depGradeOneId;

    @ApiModelProperty(value = "系统占用比例")
    @Column(name = "en_system_allocation", columnDefinition = "decimal(20,4) comment '占用比例'")
    private BigDecimal systemAllocation;
    @ApiModelProperty(value = "应用名称")
    @Column(name = "vc_component_name", columnDefinition = "varchar(50) comment '应用名称'")
    private String vcComponentName;

    @ApiModelProperty(value = "部门分摊比例")
    @Column(name = "en_dep_allocation", columnDefinition = "decimal(20,4) comment '部门分摊比例'")
    private BigDecimal depAllocation;

    @ApiModelProperty(value = "部门分摊金额")
    @Column(name = "en_dep_amount", columnDefinition = "decimal(20,4) comment '部门分摊金额'")
    private BigDecimal depAmount;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @Column(name = "dt_create_time", columnDefinition = "datetime comment '创建时间'")
    protected LocalDateTime createTime;

    //只有回写云管数据是会更新数据
    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @org.hibernate.annotations.UpdateTimestamp
    @Column(name = "dt_update_time", columnDefinition = "datetime comment '更新时间'")
    protected LocalDateTime updateTime;

    @ApiModelProperty(value = "操作人")
    @Column(name = "vc_operator", columnDefinition = "varchar(50) comment '操作人'")
    private String operator;
}
